package com.atguigu.jxc.controller;

import com.atguigu.jxc.entity.Goods;
import com.atguigu.jxc.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RequestMapping("/goods")
@RestController
public class GoodsContrller2 {
    @Autowired
    GoodsService goodsService;
    @PostMapping("/listInventory")
    private Map<String ,Object> listInventory(Integer page, Integer rows, String codeOrName, Integer goodsTypeId){
       List<Goods> goods =  goodsService.list((page-1*rows), rows, codeOrName, goodsTypeId);
       Map<String,Object> map = new HashMap();
       map.put("rows",goods);
        return map;
    }
}
